﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Medical.Entity;
using Medical.Business;
using System.Data;


/// <summary>
/// 专家团队页面
/// </summary>
public partial class Doctor : WebPage
{
    protected int nPageIndex = 1;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataRow[] drList = Until.GetSEO().Select("Type=3");
            if (drList.Length > 0)
                SetPageInfo(drList[0]["PageTitle"].ToString() == string.Empty ? ("权威专家_" + strWebTitle) : drList[0]["PageTitle"].ToString(), drList[0]["PageKeywords"].ToString(), drList[0]["PageDescription"].ToString());
            InitData();
        }
    }

    protected void InitData()
    {
        //专家团队介绍
        //BisArticle bisArticle = new BisArticle();
        //Article aboutInfo = bisArticle.GetArticle(ArticelTypeEnum.About, 4);
        //if (aboutInfo != null)
        //{
        //    ltlInfo.Text = aboutInfo.Info;
        //}
        int nRecordCount = 0;
        int nPageCount = 0;
        //文章信息列表绑定
        int nOrderType = 0;
        //专家团队
        DataTable dtDoctor = new BisArticle().GetArticleList(0, 0, ArticelTypeEnum.Expert, string.Empty, string.Empty, string.Empty, nOrderType, nPageIndex, anpPage.PageSize, ref nPageCount, ref nRecordCount);
        rptArticle.DataSource = dtDoctor;
        rptArticle.DataBind();
        anpPage.EnableUrlRewriting = true;
        anpPage.UrlRewritePattern = @"~doctor/?page={0}";
    }

    /// <summary>
    /// 列表绑定处理
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void rptArticle_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataTable dtSort = (DataTable)((Repeater)sender).DataSource;
        Literal ltlInfo = e.Item.FindControl("ltlInfo") as Literal;
        string strInfo = strInfo = Common.NoHTML(dtSort.Rows[e.Item.ItemIndex]["Info"].ToString());
        ltlInfo.Text = (strInfo.Length > 160 ? strInfo.Substring(0, 160) : strInfo) + "…";
    }
}